package com.util;

import com.bean.User;

import javax.servlet.http.HttpSession;

/**
 * @Author: 柏竹
 * @Description: 用户工具类
 * @Date_Created_in: 2021-05-24 9:45
 * @Modified_By: Sans
 * @Project: 快递e栈
 */
public class UserUtil {
    
    public static String getUserName(HttpSession session) {
        return (String) session.getAttribute("username");
    }
    public static void setUserName(HttpSession session , String username){
        session.setAttribute("username",username);
    }
    
    public static String getUserPhone(HttpSession session) {
        String userPhone = (String)session.getAttribute("userPhone");
        return userPhone==null?"18888888888":userPhone;
    }
    public static void setUserPhone(HttpSession session,String userPhone){
        session.setAttribute("userPhone",userPhone);
    }
    
    public static String getLoginSms(HttpSession session , String userPhone) {
        return (String)session.getAttribute(userPhone);
    }
    public static void setLoginSms(HttpSession session , String userPhone , String code) {
        session.setAttribute(userPhone,code);
    }
    
    public static User getWxUser(HttpSession session){
        return (User) session.getAttribute("wxUser");
    }
    public static void setWxUser(HttpSession session , User user){
        session.setAttribute("wxUser",user);
    }
    
}
